package smartclass.present;

import java.util.ArrayList;

import com.jeremyfeinstein.slidingmenu.example.R;

import smartclass.adapter.ItemGridAdapter;
import smartclass.entity.ItemGridPage;
import smartclass.slidingmenu.example.LeftAndRightActivity;


import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

public class ShowMultiScreen extends Activity {

	private GridView gridPage;
	private ArrayList<ItemGridPage> array;
	private ItemGridAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.gidview);
		gridPage = (GridView) findViewById(R.id.gridview);
		array = new ArrayList<ItemGridPage>();
		adapter = new ItemGridAdapter(this, R.layout.item_page, array);
		gridPage.setAdapter(adapter);
		ArrayList<Bitmap> arrayBitmap = new ArrayList<Bitmap>();
		arrayBitmap = LeftAndRightActivity.addBitmap(null);
		for (int i = 1; i <= arrayBitmap.size(); i++) {
			array.add(new ItemGridPage("Page " + i, arrayBitmap.get(i-1)));

		}
		gridPage.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(ShowMultiScreen.this,
						LogInActivity.class);
				intent.putExtra("numberPageSelected", arg2);
				setResult(RESULT_OK, intent);
				finish();
			}
		});

	}

}
